package com.quick.develop.flowable.application.impl;

import cn.hutool.core.collection.CollUtil;
import com.quick.develop.flowable.application.IBpmTaskAssigneeApplication;
import com.quick.develop.flowable.domain.rule.BpmProcessRule;
import com.quick.develop.flowable.domain.vo.system.SysApiRole;
import com.quick.develop.flowable.service.process.IBpmExampleRuleService;
import com.quick.develop.flowable.service.process.IBpmProcessInstanceService;
import com.quick.develop.flowable.service.task.IBpmTaskService;
import com.quick.develop.framework.security.utils.SecurityUtils;
import liquibase.pro.packaged.S;
import lombok.extern.slf4j.Slf4j;
import org.flowable.variable.api.delegate.VariableScope;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.*;

/**
 * @author junyuan.liu
 * @description: 人员相关接口
 * @date 2022/5/26 14:15
 */
@Component
@Slf4j
public class BpmTaskAssigneeApplicationImpl implements IBpmTaskAssigneeApplication {
    @Resource
    private IBpmProcessInstanceService bpmProcessInstanceService;

    @Resource
    private IBpmExampleRuleService bpmExampleRuleService;

    @Resource
    private IBpmTaskService bpmTaskService;


    @Override
    public Set<String> calculateTaskCandidateUsers(String processInstanceId, BpmProcessRule rule, VariableScope variableScope) {
        // TODO 重写选人规则
        return new HashSet<>();
    }

    @Override
    public String getUserNameByUserCode(String userCode) {
        return SecurityUtils.getUserName();
    }

    @Override
    public Map<String, String> getUsersNameByUserCode(Collection<String> userCodes) {
        if (CollUtil.isNotEmpty(userCodes)){
            HashMap<String, String> map = new HashMap<>();
            userCodes.forEach(userCode -> {
                map.put(userCode, SecurityUtils.getUserName());
            });
            return map;
        }
        return new HashMap<>();
    }

    @Override
    public Map<String, String> getUsersRealNameByUserCode(Collection<String> userCodes) {
        return null;
    }

    @Override
    public String getUserProject(String userCode) {
        return null;
    }

    @Override
    public List<SysApiRole> getUserRoles(String userCode) {
        return null;
    }

    @Override
    public Map<String, Set<String>> getTaskCandidateUserByRoleId(Map<String, Set<String>> map) {
        return null;
    }

    @Override
    public Map<String, Set<String>> getTaskCandidateUserNameStr(Map<String, Set<String>> taskRoleMap) {
        return null;
    }

    @Override
    public Set<String> checkUserDept(Long deptId, Collection<String> userCodes) {
        return null;
    }

    @Override
    public Set<String> getLeaderUsers() {
        return null;
    }

    @Override
    public Set<String> calculateTaskCandidateUsersByDeptMember(Set<String> optionsDept) {
        return null;
    }

    @Override
    public Set<String> calculateTaskCandidateUsersByRole(Set<String> optionsRole) {
        return null;
    }
}
